package com.shizhanzhe.zxbapp.vip;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.gyf.barlibrary.ImmersionBar;
import com.shizhanzhe.zxbapp.R;
import com.shizhanzhe.zxbapp.bean.UserBean;
import com.shizhanzhe.zxbapp.task.TabAdapter;
import com.shizhanzhe.zxbapp.utils.SharedPreferencesUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zz9527 on 2018/12/4.
 */
public class GameActivity extends FragmentActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game);
        ImmersionBar.with(this)
                .fitsSystemWindows(true)  //使用该属性,必须指定状态栏颜色
                .statusBarColor(R.color.colorAccent)
                .init();
        findViewById(R.id.backarea).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                finish();
            }
        });

        ViewPager viewpager = findViewById(R.id.viewpager);
        final TabLayout tab = findViewById(R.id.tab);
        List<String> tabTitle = new ArrayList<>();
        tabTitle.add("一区");
        tabTitle.add("二区");
//        tabTitle.add("三区");
        List<Fragment> fragments = new ArrayList<>();
        TJFragment tjFragment = new TJFragment();
        JXWFragment jxwFragment = new JXWFragment();
        XWFragment xwFragment = new XWFragment();
        fragments.add(tjFragment);
//        fragments.add(jxwFragment);
        fragments.add(xwFragment);
        TabAdapter adapter = new TabAdapter(getSupportFragmentManager(), fragments, tabTitle);
        //给ViewPager设置适配器
        viewpager.setAdapter(adapter);
        //将TabLayout和ViewPager关联起来。
        tab.setupWithViewPager(viewpager);
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        ImmersionBar.with(this).destroy();
    }

}
